<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.w3.org/1999/xhtml">
<head th:replace="admin/_fragments :: head(~{::title})">
    <meta charset="UTF-8">
    <meta name="viewpoint" content="width=device-width, initial-scale=1.0">
    <title>新增分类</title>
    <link href="https://cdn.bootcss.com/semantic-ui/2.4.1/semantic.min.css" rel="stylesheet">
    <link href="../../static/css/myCss.css" rel="stylesheet">
</head>
<body>
<nav th:replace="admin/_fragments :: menu(3)" class="ui inverted attached segment my-padding-tb-mini my-shadow-small ">
    <div class="ui container">
        <div class="ui inverted secondary menu stackable">
            <h2 class="ui header teal item">管理后台</h2>
            <a href="#" class="my-item item my-mobile-hide">博客</a>
            <a href="#" class="active my-item item my-mobile-hide">标签</a>
            <a href="#" class="my-item item my-mobile-hide">分类</a>

            <!--            头像-->
            <div class="my-item right menu my-mobile-hide">
                <div class="ui dropdown item">
                    <div class="text">
                        <img class="ui avatar image QR" src="../../static/images/pika.jpg">
                        登陆者用户名
                    </div>
                    <i class="dropdown icon"></i>
                    <div class="menu">
                        <a href="#" class="item">注销</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <a href="#" class="menu tooggle ui icon black button my-top-right my-mobile-show"><i class="sidebar icon"></i></a>
</nav>

<div class="ui menu attached pointing animated fadeInDown">
    <div class="ui container">
        <div class="right menu">
            <a href="#" th:href="@{/admin/tags/input}" class="active teal item">新增</a>
            <a href="#" th:href="@{/admin/tags}" class="item">列表</a>
        </div>
    </div>
</div>

<div class="my-padding-tb-large my-container-small animated fadeInUp">
    <div class="ui container">
        <form action="#" method="post" th:object="${tag}" th:action="*{id}==null ? @{/admin/tags} : @{/admin/tags/{id}(id=*{id})}" class="ui form">
            <input type="hidden" name="id" th:value="*{id}">
            <div class="field">
                <div class="ui left labeled input">
                    <div class="ui teal basic label">名称</div>
                    <input type="text" name="tagName" placeholder="标签名称" th:value="*{tagName}">
                </div>
            </div>

            <div class="ui error message"></div>
            <!--/*/
            <div class="ui negative message" th:if="${#fields.hasErrors('tagName')}"  >
              <i class="close icon"></i>
              <div class="header">验证失败</div>
              <p th:errors="*{tagName}">提交信息不符合规则</p>
            </div>
             /*/-->

            <div class="ui right aligned container">
                <button type="button" class="ui button" onclick="window.history.go(-1)">返回</button>
                <button class="ui teal submit button">新增</button>
            </div>

        </form>
    </div>


</div>

<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/semantic-ui/2.4.1/semantic.min.js"></script>

<script>
    $('.menu.tooggle').click(function () {
        $('.my-item').toggleClass('my-mobile-hide');
    });

    $('.ui.dropdown')
        .dropdown({
            on: "hover"
        })
    ;
    $('.ui.form').form({
        fields: {
            tagName: {
                identifier: 'tagName',
                rules: [{
                    type: 'empty',
                    prompt: '分类：请输入分类名称'
                }]
            }
        }
    });

</script>
</body>
</html>